<%-- 
    Document   : ModificarRM
    Created on : 17/07/2008, 09:09:12 AM
    Author     : Arturo
--%>

<%@ page language="java" import="java.util.*" %>
<%@ page language="java" import="com.akcess.vo.*" %>
<%@ page language="java" import="com.akcess.impl.*" %>
<%@ page language="java" import="java.sql.*" %>
<%@ page language="java" import="manejadores.*" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
            String path = request.getContextPath();
            String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";

%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
    <head>
         <!--  Version: Multiflex-3.12 / Overview                    --><!--  Date:    January 20, 2008                             --><!--  Design:  www.1234.info                                --><!--  License: Fully open source without restrictions.      --><!--           Please keep footer credits with the words    --><!--           "Design by 1234.info" Thank you!             -->
        <script language="JavaScript">	
        <!--
            function evalua(formulario) {
                var tipoRec = formulario.TipoRecurso.value;
                                               
                if (tipoRec=="#") {
                  alert("Debe seleccionar algun tipo de recurso");                                           
                }
                else {
                    formulario.submit();
                }
            }
	
	
        //-->
        </script>
        
        
        <base href="<%=basePath%>">
        <link rel="stylesheet" type="text/css" media="screen,projection,print" href="./css/layout4_setup.css">
        <link rel="stylesheet" type="text/css" media="screen,projection,print" href="./css/layout4_text.css">
        <link rel="icon" type="image/x-icon" href="./img/favicon.ico">
        <title>SRR - Sistema de Reserva de Recursos</title><!-- Global IE fix to avoid layout crash when single word size wider than column width --><!--[if IE]><style type="text/css"> body {word-wrap: break-word;}</style><![endif]-->
        <link href="./css/highlighter.css" type="text/css" rel="stylesheet">
        <link href="./css/highlighter_002.css" type="text/css" rel="stylesheet">
    </head>
    <body>
        <!-- Main Page Container -->
        <div class="page-container">
            
            <!-- For alternative headers START PASTE here -->

 <jsp:include page="../Header.jsp"/>
        
        <!-- For alternative headers END PASTE here -->

            <!-- B. MAIN -->
            <div class="main">
                
                <jsp:include page="../barraOperaciones.jsp"/>  
                
                <!-- B.2 MAIN CONTENT -->
                <div class="main-content">  
                    <!-- Pagetitle -->
                    
                    
                        <table border="1">
                            <tbody>
                  
                         <%
                           Connection con = (Connection) session.getAttribute("conexion");
                           String id_str=request.getParameter("id");
                           out.println("<form name=\"Modificar\" action=\"GestionarRecursos_Moviles?hacer=modificacion&id="+id_str+"\" method=\"post\">");              
                           String nombre=request.getParameter("nombreRecurso");
                           out.println("<h2 class=\"pagetitle\">Modificar Recurso "+ nombre +"</h2>");
                           if(id_str!=null)
                            {
                            
                                long id_Recurso =Long.parseLong(id_str);
                                ManejadorRecursoMovil manejarRM= new ManejadorRecursoMovil(con);
                                Recurso_movil rm=manejarRM.ObtenerRM(id_Recurso);
                                Datos_atributo []datosRM=rm.getDatos();
                                out.println("<input type=\"hidden\" name=\"" + "TipoRecurso" + "\" value=\""+datosRM[0].getId_tipo_recurso()+"\">");
                                out.println("<table border=\"0\">");
                                out.println("<tbody>");
                                    
                                    out.println("<tr>");
                                    out.println("<th class=\"top\">" + "Nombre" + "</th>");
                                    out.println("<td><input type=\"text\" name=\"nombre\" value=\""+rm.getNombre()+"\"></td>");
                                    out.println("</tr>");
                            for (int i = 0; i < datosRM.length; i++) {
                                String campo = datosRM[i].getNombre();
                                out.println("<tr>");
                                out.println("<th class=\"top\">" + campo + "</th>");
                                out.println("<td><input type=\"text\" name=\"" + campo.replace(" ", "_") + "\" value=\""+datosRM[i].getValor()+"\"></td>");
                                out.println("</tr>");
                                
                            }
                                    out.println("<tr>");
                                    out.println("<th class=\"top\">" + "Disponible" + "</th>");
                                    if(rm.getDisponible())
                                        out.println("<td><input type=\"checkbox\" name=\"disponible\" value=\"true\" checked ></td>");
                                    else
                                        out.println("<td><input type=\"checkbox\" name=\"disponible\" value=\"true\"></td>");
                                    out.println("</tr>");
                                    out.println("<tr>");
                                    out.println("<th class=\"top\">" + "Observacion" + "</th>");
                                    out.println("<td><textarea name=\"" + "observacion"+ "\" cols=\"15\" rows=\"5\" >"+rm.getObservacion()+"</textarea></td>");
                                    out.println("</tr>");
                            out.println("</tbody>");
                            out.println("</table>");
                            
                            out.println("<table border=\"0\">");
                            out.println("<tbody>");
                            out.println("<tr>");
                            out.println("<td>");
                            out.println("<input type=\"submit\" name=\"btnGuardar\" value=\"Guardar\">");
                            out.println("<input type=\"button\" name=\"btnCancelar\" value=\"Cancelar\" onclick=\"location.href = 'GestionarRecursos_Moviles?hacer=Listar'\">");
                            out.println("</center>");
                            out.println("</td>");
                                        
                            out.println("</tr>");
                            out.println("</tbody>");
                            out.println("</table>");  
                            }//fin_if
                                %>   
                            </table>
                            </form>  
                    <!-- B.3 SUBCONTENT -->
                </div>
                
                
            
                </div>
                <!-- C. FOOTER AREA -->   
                <%@include file="../footer.jsp"%> 
        </div>
        
    </body>
</html>
